import router from './router'
import { getToken } from './utils/auth'

const whiteList = ['/login']
router.beforeEach((to, from, next) => {
  const token = getToken()
  if (token) {
    next()
  } else if (whiteList.includes(to.path)) {
    next()
  } else {
    next('./login')
  }
})
